Expand description
::cfg_eval
#[cfg_eval]
in stable Rust.
Example
use ::macro_rules_attribute::apply;
#[macro_use]
extern crate cfg_eval;
fn main()
{
let output_without_cfg_eval = {
#[apply(stringify!)]
enum Foo {
Bar,
#[cfg(FALSE)]
NonExisting,
}
};
// This is usually not great.
assert!(output_without_cfg_eval.contains("NonExisting"));
let output_with_cfg_eval = {
#[cfg_eval]
#[apply(stringify!)]
enum Foo {
Bar,
#[cfg(FALSE)]
NonExisting,
}
};
assert_eq!(output_with_cfg_eval, stringify! {
enum Foo {
Bar,
}
});
}
Attribute Macros
#[::core::prelude::v1::cfg_eval]
in stable Rust.